home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 1.iso / toolbox / src / exampleCode / opengl / GLUT / lib / fglut / glut_winmisc.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-11-11  |  2.6 KB  |  109 lines

  1. /* Copyright (c) Mark J. Kilgard, 1994.  */
  2.  
  3. /* This program is freely distributable without licensing fees
  4.    and is provided without guarantee or warrantee expressed or
  5.    implied. This program is -not- in the public domain. */
  6.  
  7. #include <stdlib.h>
  8. #include <stdio.h>
  9. #include <string.h>
  10. #include <assert.h>
  11. #include <X11/Xlib.h>
  12. #include <X11/Xutil.h>
  13. #include <X11/Xatom.h>  /* for XA_STRING atom */
  14.  
  15. #include <GL/glut.h>
  16. #include "glutint.h"
  17.  
  18. /* CENTRY */
  19. void
  20. glutSetWindowTitle(char *title)
  21. {
  22.   XTextProperty textprop;
  23.  
  24.   assert(!__glutCurrentWindow->parent);
  25.   textprop.value = (unsigned char *) title;
  26.   textprop.encoding = XA_STRING;
  27.   textprop.format = 8;
  28.   textprop.nitems = strlen(title);
  29.   XSetWMName(__glutDisplay,
  30.     __glutCurrentWindow->win, &textprop);
  31.   XFlush(__glutDisplay);
  32. }
  33.  
  34. void
  35. glutSetIconTitle(char *title)
  36. {
  37.   XTextProperty textprop;
  38.  
  39.   assert(!__glutCurrentWindow->parent);
  40.   textprop.value = (unsigned char *) title;
  41.   textprop.encoding = XA_STRING;
  42.   textprop.format = 8;
  43.   textprop.nitems = strlen(title);
  44.   XSetWMIconName(__glutDisplay,
  45.     __glutCurrentWindow->win, &textprop);
  46.   XFlush(__glutDisplay);
  47. }
  48.  
  49. void
  50. glutPositionWindow(int x, int y)
  51. {
  52.   __glutCurrentWindow->desiredX = x;
  53.   __glutCurrentWindow->desiredY = y;
  54.   __glutCurrentWindow->desiredConfMask |= CWX | CWY;
  55.   __glutPutOnWorkList(__glutCurrentWindow, GLUT_CONFIGURE_WORK);
  56. }
  57.  
  58. void
  59. glutReshapeWindow(int w, int h)
  60. {
  61.   if(w <= 0 || h <= 0) 
  62.     __glutWarning("glutReshapeWindow: non-positive width or height not allowed");
  63.  
  64.   __glutCurrentWindow->desiredWidth = w;
  65.   __glutCurrentWindow->desiredHeight = h;
  66.   __glutCurrentWindow->desiredConfMask |= CWWidth | CWHeight;
  67.   __glutPutOnWorkList(__glutCurrentWindow, GLUT_CONFIGURE_WORK);
  68. }
  69.  
  70. void
  71. glutPopWindow(void)
  72. {
  73.   __glutCurrentWindow->desiredStack = Above;
  74.   __glutCurrentWindow->desiredConfMask |= CWStackMode;
  75.   __glutPutOnWorkList(__glutCurrentWindow, GLUT_CONFIGURE_WORK);
  76. }
  77.  
  78. void
  79. glutPushWindow(void)
  80. {
  81.   __glutCurrentWindow->desiredStack = Below;
  82.   __glutCurrentWindow->desiredConfMask |= CWStackMode;
  83.   __glutPutOnWorkList(__glutCurrentWindow, GLUT_CONFIGURE_WORK);
  84. }
  85.  
  86. void
  87. glutIconifyWindow(void)
  88. {
  89.   assert(!__glutCurrentWindow->parent);
  90.   __glutCurrentWindow->desiredMapState = IconicState;
  91.   __glutPutOnWorkList(__glutCurrentWindow, GLUT_MAP_WORK);
  92. }
  93.  
  94. void
  95. glutShowWindow(void)
  96. {
  97.   __glutCurrentWindow->desiredMapState = NormalState;
  98.   __glutPutOnWorkList(__glutCurrentWindow, GLUT_MAP_WORK);
  99. }
  100.  
  101. void
  102. glutHideWindow(void)
  103. {
  104.   __glutCurrentWindow->desiredMapState = WithdrawnState;
  105.   __glutPutOnWorkList(__glutCurrentWindow, GLUT_MAP_WORK);
  106. }
  107.  
  108. /* ENDCENTRY */
  109.